/*
 *  txdnet.cn tonydon
 * 
 */
package cn.txdnet.txcms.dao;

import cn.txdnet.txcms.domain.Manager;
import cn.txdnet.txcms.domain.Mgrole;
import cn.txdnet.txcms.mapper.AdminMapper;
import java.util.List;
import java.util.Map;

/**
 *
 * @author txdnet
 */
public class AdminDAO extends MybatisBaseDAO{
    
    /**
     * 更具用户名查询管理员信息
     * @param mgrname
     * @return 
     */
    public Manager loginQuery(String mgrname){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.loginQuery(mgrname);
    }
    
    /**
     * 建立管理员
     * @param m
     * @return 
     */
    public int makeAdmin(Manager m){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.makeAdmin(m);
    }
    
    /**
     * 查询管理员数量
     * @param m
     * @return 
     */
    public int countByFactor(Map m){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.countByFactor(m);
    }
    
    /**
     * 查询管理员列表
     * @param m
     * @return 
     */
    public List<Map> listByFactor(Map m){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.listByFactor(m);
    }
            
    
    
    /**
     * 更新管理员信息
     * @param m
     * @return 
     */
    public int upateBase(Map m){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.upateBase(m);
    }
    
    /**
     * 删除管理员
     * @param mgrid
     * @return 
     */
    public int deleteAdmin(int mgrid){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.deleteAdmin(mgrid);
    }
    
    /**
     * 得到管理员类目ID
     * @param mgrid
     * @return 
     */
    public String queryCids(int mgrid){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.queryCids(mgrid);
    }
    
    /**
     * 查询账户名是否存在
     * @param mgrname
     * @return 
     */
    public int queryRepeatMgrname(String mgrname){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.queryRepeatMgrname(mgrname);
    }
    
    /**
     * 查询管理员角色ID
     * @param mgrid
     * @return 
     */
    public int queryRoleId(int mgrid){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.queryRoleId(mgrid);
    }
    
    /**
     * 建立角色
     * @param r
     * @return 
     */
    public int makeRole(Mgrole r){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.makeRole(r);
    }
    
    /**
     * 更新角色
     * @param r
     * @return 
     */
    public int updateRole(Mgrole r){
         AdminMapper mapper = this.getMapper(AdminMapper.class);
         return mapper.updateRole(r);
    }
    
    
    /**
     * 删除角色
     * @param roleid
     * @return 
     */
    public int deleteRole(int roleid){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.deleteRole(roleid);
    }
    
    /**
     * 列出所有角色
     * @return 
     */
    public List<Map> listRoleBase(){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.listRoleBase();
    }
    
    /**
     * 列出所有角色全部信息
     * @return 
     */
    public List<Mgrole>  listRole(){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.listRole();
    }
    
    /**
     *  查询角色详情
     * @param roleid
     * @return 
     */
    public Mgrole queryRole(int roleid){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.queryRole(roleid);
    }
    
    /**
     * 查询角色数量
     * @return 
     */
    public int countRole(){
        AdminMapper mapper = this.getMapper(AdminMapper.class);
        return mapper.countRole();
    }
}
